package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.ActivityJoiner;
import com.ruoyi.swimming.domian.MallGoodsSku;
import com.ruoyi.swimming.mapper.ActivityJoinerMapper;
import com.ruoyi.swimming.mapper.MallGoodsSkuMapper;
import com.ruoyi.swimming.service.IMallGoodsSkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * skuService业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class MallGoodsSkuServiceImpl extends ServiceImpl<MallGoodsSkuMapper, MallGoodsSku> implements IMallGoodsSkuService
{
    @Autowired
    private MallGoodsSkuMapper mallGoodsSkuMapper;

    /**
     * 查询sku
     * 
     * @param id skuID
     * @return sku
     */
    @Override
    public MallGoodsSku selectMallGoodsSkuById(Long id)
    {
        return mallGoodsSkuMapper.selectMallGoodsSkuById(id);
    }

    /**
     * 查询sku列表
     * 
     * @param mallGoodsSku sku
     * @return sku
     */
    @Override
    public List<MallGoodsSku> selectMallGoodsSkuList(MallGoodsSku mallGoodsSku)
    {
        return mallGoodsSkuMapper.selectMallGoodsSkuList(mallGoodsSku);
    }

    /**
     * 新增sku
     * 
     * @param mallGoodsSku sku
     * @return 结果
     */
    @Override
    public int insertMallGoodsSku(MallGoodsSku mallGoodsSku)
    {
        mallGoodsSku.setCreateTime(DateUtils.getNowDate());
        return mallGoodsSkuMapper.insert(mallGoodsSku);
    }

    /**
     * 修改sku
     * 
     * @param mallGoodsSku sku
     * @return 结果
     */
    @Override
    public int updateMallGoodsSku(MallGoodsSku mallGoodsSku)
    {
        mallGoodsSku.setUpdateTime(DateUtils.getNowDate());
        return mallGoodsSkuMapper.updateById(mallGoodsSku);
    }

    /**
     * 批量删除sku
     * 
     * @param ids 需要删除的skuID
     * @return 结果
     */
    @Override
    public int deleteMallGoodsSkuByIds(Long[] ids)
    {
        return mallGoodsSkuMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除sku信息
     * 
     * @param id skuID
     * @return 结果
     */
    @Override
    public int deleteMallGoodsSkuById(Long id)
    {
        return mallGoodsSkuMapper.deleteById(id);
    }
}
